
#define NDCGFX_USE_UNORDEREDMAP
#ifdef  NDCGFX_USE_UNORDEREDMAP
#define NDCgFX_MAP std::tr1::unordered_map
#else
#define NDCgFX_MAP std::map
#endif

namespace Nadine{

	//--------------------------------------------------------------------------------------
	// NDCGEffectMgr
	//--------------------------------------------------------------------------------------
	class NDCGEffectMgr :public NDBaseObject
	{
	public:
		struct sPass{
			std::string strPassName;
			CGpass		cgPass;

		};

		struct sTechnique{
			std::string strTechniqueName;
			CGtechnique cgTechnique;

			//content
			NDCgFX_MAP<NDUID, sPass*> passMap;
		};

		struct sCGFile
		{
			std::string strFileName;
			CGeffect	cgEffect;

			//content
			NDCgFX_MAP<NDUID, sTechnique*> techniqueMap;
		};

	private:
		NDCgFX_MAP<NDUID, sCGFile*> m_myCGFileMap;
		CGpass m_currentBindingPass;

	protected:
	public:
		NDCGEffectMgr() :NDBaseObject(99),m_currentBindingPass(0) {}
		virtual ~NDCGEffectMgr() {assert(m_myCGFileMap.empty() ==true);}

		virtual void release()
		{
			//clear m_myCGFileMap;
			delAllEffect();

			this->m_bReleased =true;
		}

		bool addCGEffectFromFile(const char* pCGFileName); //load cgfx file
		void delCGEffect(const char* pCGName);
		void delCGEffect(sCGFile* pCGFile);
		void delAllEffect();

		sCGFile*    getCGEffect(const char* pEffectName);
		sTechnique* getCGTech(sCGFile* pCGFilePtr, const char* pTechName);
		sTechnique* getCGTech(const char* pEffectName, const char* pTechName);
		sPass*		getCGPass(sTechnique* pTechniquePtr, const char* pPassName);
		sPass*		getCGPass(const char* pEffectName, const char* pTechName, const char* pPassName);


		//CGFX APPLICATION
		//BIND PASS
		void bindCGPass(sPass* pPassPtr);
		void unbindCGPass(sPass* pPassPtr =0);

	};

}